home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cxt220.zip / EXAMPLE.DOC < prev    next >
Text File  |  1994-03-20  |  24KB  |  794 lines

  1.  
  2.  
  3.         EXAMPLE.DOC
  4.  
  5.         This file describes the use of CFT and CST,  the  main  parts  of
  6.         CXT,  the  C  EXPLORATION  TOOLS.  The  example session shows the
  7.         processing of a small program composed of two source  files  X1.C
  8.         and X2.C and one include file X.H as listed below.  When invoked,
  9.         the program produces the following output:
  10.  
  11.              hello world ....................
  12.  
  13.         The source code of the files is as follows:
  14.  
  15.         SOURCE LISTING 1: X1.C
  16.              #include <stdio.h>
  17.              #include "x.h"
  18.  
  19.              WORD main(void);
  20.              VOID x1(void);
  21.  
  22.              WORD main(void)
  23.              {
  24.                x1();
  25.                y1();
  26.                return(0);
  27.              }
  28.  
  29.              static VOID x2(void)
  30.              {
  31.                printf("hello ");
  32.              }
  33.  
  34.              VOID x1(VOID)
  35.              {
  36.                x2();
  37.              }
  38.         END OF SOURCE LISTING 1
  39.  
  40.         SOURCE LISTING 2: X2.C
  41.              #include <stdio.h>
  42.              #include "x.h"
  43.  
  44.              VOID y1(VOID);
  45.              static int x1(void);
  46.              static void x3(void);
  47.  
  48.              VOID y1(VOID)
  49.              {
  50.                x1();
  51.              }
  52.  
  53.              static char x2(VOID)
  54.              {
  55.                printf("world ");
  56.                x3();
  57.                return(1);
  58.              }
  59.  
  60.  
  61.                                       - 1 -
  62.  
  63.  
  64.  
  65.              static int x1(void)
  66.              {
  67.                x2();
  68.                return(1);
  69.              }
  70.  
  71.              static void x3(void)
  72.              {
  73.                static i = 0;
  74.  
  75.                printf(".");
  76.  
  77.                if (++i < 20)
  78.                  x3();
  79.              }
  80.         END OF SOURCE LISTING 2
  81.  
  82.         SOURCE LISTING 3: X.H
  83.              typedef void    VOID;
  84.              typedef char    BYTE;
  85.              typedef int     WORD;
  86.              typedef long    DWORD;
  87.  
  88.              typedef struct _s_x
  89.              {
  90.                BYTE   a;
  91.                WORD   b;
  92.                BYTE   string[20];
  93.                FILE  *fptr;
  94.              } S_XT;
  95.  
  96.              extern VOID y1(VOID);
  97.         END OF SOURCE LISTING 3
  98.  
  99.         First of all, the two source files X1.C and X2.C are processed by
  100.         CFT to look for  the  functions  and  their  hierarchy  with  the
  101.         following command line (see documentation for description):
  102.  
  103.              CFT -m -rauspMP -TMSC70,L -cs -Cs -na -Zs -z x?.c
  104.  
  105.         The  resulting  screen  output  during processing is shown below.
  106.         Besides  the  default  informations  about  the   file   actually
  107.         processed there are also some warnings given.  (NOTE: Some of the
  108.         following output lines are truncated due to their length.)
  109.  
  110.         SCREEN OUTPUT
  111.  
  112.         CFT (TM) C FUNCTION TREE GENERATOR 2.12   Copyright (C) J.M 1988-
  113.  
  114.         processing C:/C/CXT/DOC/X1.C
  115.         C:/C/CXT/DOC/X1.C(15): warning: function 'x2' definition used  as
  116.         prototype
  117.         processing C:/C/CXT/DOC/X2.C
  118.         C:/C/CXT/DOC/X2.C(14):  warning: function 'x2' definition used as
  119.         prototype
  120.  
  121.  
  122.                                       - 2 -
  123.  
  124.  
  125.  
  126.         writing output file CFT.LST
  127.  
  128.         END OF SCREEN OUTPUT
  129.  
  130.         The finally generated  output  file  CFT.LST  has  the  following
  131.         listed  contents.  For  further informations about the meaning of
  132.         the several sections listed in the output file see  the  CFT  and
  133.         CST documentation.
  134.  
  135.         CFT OUTPUT: CFT.LST
  136.  
  137.         ╔═══════════════════════════════════════════════════════════════
  138.         ║    CFT (TM) C FUNCTION TREE GENERATOR 2.12   Copyright (C) J.M
  139.         ╚═══════════════════════════════════════════════════════════════
  140.  
  141.  
  142.         ╔═══════════════════════════════════════════════════════════════
  143.         ║        CFT is part of CXT - the C EXPLORATION TOOLS
  144.         ║        You are expressly prohibited from selling this software
  145.         ║        of it in any form, distributing it with another product
  146.         ║        removing this notice. This software is Copyright (C)
  147.         ║        File creation date: Sat Nov 21 13:08:22 1992
  148.         ╚═══════════════════════════════════════════════════════════════
  149.  
  150.         ╔═══════════════════════════════════════════════════════════════
  151.         ║  EXAMPLE: int test()  (9999) <DMPCA> <TEST.C, 100>
  152.         ║  - int          : function return type
  153.         ║  - test()       : function name
  154.         ║  - (9999)       : function cross reference number
  155.         ║  - <DMPCA>      : function found as D=definition, M=macro, P=P
  156.         ║                   C=function call, A=assembler function
  157.         ║  - <TEST.C, 100>: file name, line number
  158.         ╚═══════════════════════════════════════════════════════════════
  159.  
  160.  
  161.         ╔═══════════════════════════════════════════════════════════════
  162.         ║                     FUNCTION CALLTREE HIERARCHY LISTING
  163.         ╚═══════════════════════════════════════════════════════════════
  164.  
  165.         WORD main()  (1) <DP> <X1.C, 8>
  166.          ├ VOID x1()  (2) <DPC> <X1.C, 20>
  167.          │  └ static VOID x2()  (3) <DC> <X1.C, 15>
  168.          │     └ int printf()  (4) <PC> <?>
  169.          │
  170.          └ VOID y1()  (5) <DPC> <X2.C, 9>
  171.             └ static int x1()  (6) <DPC> <X2.C, 21>
  172.                └ static char x2()  (7) <DC> <X2.C, 14>
  173.                   ├ int printf()
  174.                   └ static void x3()  (8) <DPC> <X2.C, 27>
  175.                      ├ int printf()
  176.                      └ static void x3()  ...recursive call of (8)
  177.  
  178.         WORD main()  ...relations shown at (1)
  179.  
  180.         int printf()  ...relations shown at (4)
  181.  
  182.  
  183.                                       - 3 -
  184.  
  185.  
  186.  
  187.         VOID x1()  ...relations shown at (2)
  188.  
  189.         static int x1()  ...relations shown at (6)
  190.  
  191.         static VOID x2()  ...relations shown at (3)
  192.  
  193.         static char x2()  ...relations shown at (7)
  194.  
  195.         static void x3()  ...relations shown at (8)
  196.  
  197.         VOID y1()  ...relations shown at (5)
  198.  
  199.  
  200.         ╔═══════════════════════════════════════════════════════════════
  201.         ║               TOTAL NUMBER OF FUNCTIONS REFERENCED :    8
  202.         ║               NUMBER OF FUNCTION DEFINITIONS       :    7
  203.         ║               NUMBER OF UNDEFINED FUNCTIONS        :    1
  204.         ║               DIRECTED CALL GRAPH WITH 8 NODES AND 10 CONNECTI
  205.         ╚═══════════════════════════════════════════════════════════════
  206.  
  207.  
  208.         ╔═══════════════════════════════════════════════════════════════
  209.         ║                             UNDEFINED FUNCTIONS
  210.         ╚═══════════════════════════════════════════════════════════════
  211.  
  212.         int printf()  (4) <PC> ...first found in <STDIO.H, 256>
  213.  
  214.  
  215.         ╔═══════════════════════════════════════════════════════════════
  216.         ║                           FUNCTION CALL STATISTICS
  217.         ╚═══════════════════════════════════════════════════════════════
  218.  
  219.         VOID x1()  (2) <DPC> <1 calls>
  220.  
  221.         static int x1()  (6) <DPC> <1 calls>
  222.  
  223.         static VOID x2()  (3) <DC> <1 calls>
  224.  
  225.         static char x2()  (7) <DC> <1 calls>
  226.  
  227.         VOID y1()  (5) <DPC> <1 calls>
  228.  
  229.         static void x3()  (8) <DPC> <2 calls>
  230.  
  231.         int printf()  (4) <PC> <3 calls>
  232.  
  233.  
  234.         ╔═══════════════════════════════════════════════════════════════
  235.         ║                         FUNCTION CALLER-MEMBER LIST
  236.         ╚═══════════════════════════════════════════════════════════════
  237.  
  238.               <no callers>
  239.         main()  (1) <0, 2>
  240.               x1()  (2) <1>
  241.               y1()  (5) <1>
  242.  
  243.  
  244.                                       - 4 -
  245.  
  246.  
  247.  
  248.               main()  (1) <1>
  249.         x1()  (2) <1, 1>
  250.               x2()  (3) <1>
  251.  
  252.               y1()  (5) <1>
  253.         x1()  (6) <1, 1>
  254.               x2()  (7) <1>
  255.  
  256.               x1()  (2) <1>
  257.         x2()  (3) <1, 1>
  258.               printf()  (4) <1>
  259.  
  260.               x1()  (6) <1>
  261.         x2()  (7) <1, 2>
  262.               printf()  (4) <1>
  263.               x3()  (8) <1>
  264.  
  265.               main()  (1) <1>
  266.         y